﻿/* 
 * Rug.Cmd part of Rugland Console Framework
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * Copyright (C) 2008 Phill Tew. All rights reserved.
 * 
 */

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Drawing;

namespace Rug.Cmd
{
    /// <summary>
    /// Version 1.0.0.0
    /// </summary>
    public partial class Helper
    {
        #region String Helpers

        public static string MakeNonNullAndEscape(string str)
        {
            if (str == null)
                return "";
            return str.Replace("\n", "\\n").Replace("\r", "\\r").Replace("\t", "\\t").Replace("\"", "\\\"");
        }

        public static string MakeNonNull(string str)
        {
            if (str == null)
                return "";
            return str;
        }

        public static bool IsNullOrEmpty(string str)
        {
            if (str == null)
                return true;

            if (str.Trim().Length == 0)
                return true;

            return false;
        }

        public static bool IsNotNullOrEmpty(string str)
        {
            if (str == null)
                return false;

            if (str.Trim().Length == 0)
                return false;

            return true;
        }

        #endregion
    }
}